/*
 * Copyright (c) 2009-2013 EvTech Project
 * All rights reserved.
 * 
 * This file is part of Game packet.
 *
 * Game packet is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or 
 * (at your option) any later version.
 *
 * Game packet is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Game packet.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
package fi.honkalampisaatio.game.xml;

import java.util.ArrayList;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;


@XmlRootElement(namespace = "fi.honkalampisaatio.setup")
public class Setup {

	private FontData fontData;

	private ArrayList<NameImageData> usercountList = new ArrayList<NameImageData>();
	
	private ArrayList<String> keys;
	
	private String languageFile;
	private String usersFolder;
	private String gamesFolder;
	private NameImageData backButton;

	private String correctAnswerImage;
	private String wrongAnswerImage;
	
	private boolean showExitButton = true;
	private boolean showOptionsButton = true;
	

	// XmLElementWrapper generates a wrapper element around XML representation
	@XmlElementWrapper(name = "usercountList")
	// XmlElement sets the name of the entities
	@XmlElement(name = "usercount")
	public void setUsercountList(ArrayList<NameImageData> usercountList) {
		this.usercountList = usercountList;
	}
	
	public ArrayList<NameImageData> getUsercountList() {
		return usercountList;
	}

	// This is helper function to get the keys of one player and two player modes
	public ArrayList<String> getNewKeys(int howManyPlayersPlayingNow) {
		ArrayList<NameImageData> keyConfigurations = getUsercountList();		
		return keyConfigurations.get(howManyPlayersPlayingNow-1).getKeyList(); // The amount of players is always +1.. for example 1 player means 0 index
	}

	// This is helper function to get mouse state
	public String getMouseConfiguration(int howManyPlayersPlayingNow) {
		ArrayList<NameImageData> keyConfigurations = getUsercountList();		
		return keyConfigurations.get(howManyPlayersPlayingNow-1).getMouse(); // The amount of players is always +1.. for example 1 player means 0 index
	}

	// XmLElementWrapper generates a wrapper element around XML representation
	@XmlElementWrapper(name = "controls")
	// XmlElement sets the name of the entities
	@XmlElement(name = "key")
	public ArrayList<String> getKeys() {
		return keys;
	}

	public void setKeys(ArrayList<String> keys) {
		this.keys = keys;
	}
	

	// XmlElement sets the name of the entities
	@XmlElement(name = "font")
	public FontData getFontData() {
		return fontData;
	}
	public void setFontData(FontData fontData) {
		this.fontData = fontData;
	}

	// XmlElement sets the name of the entities
	@XmlElement(name = "languagefile")
	public String getLanguageFile() {
		return languageFile;
	}
	public void setLanguageFile(String languageFile) {
		this.languageFile = languageFile;
	}

	// XmlElement sets the name of the entities
	@XmlElement(name = "usersfolder")
	public String getUsersFolder() {
		return usersFolder;
	}
	public void setUsersFolder(String usersFolder) {
		this.usersFolder = usersFolder;
	}

	// XmlElement sets the name of the entities
	@XmlElement(name = "gamesfolder")
	public String getGamesFolder() {
		return gamesFolder;
	}
	public void setGamesFolder(String gamesFolder) {
		this.gamesFolder = gamesFolder;
	}


	// XmlElement sets the name of the entities
	@XmlElement(name = "backbutton")
	public NameImageData getBackButton() {
		return backButton;
	}
	public void setBackButton(NameImageData backButton) {
		this.backButton = backButton;
	}


	// XmlElement sets the name of the entities
	@XmlElement(name = "correctanswer")
	public String getCorrectAnswerImage() {
		return correctAnswerImage;
	}
	public void setCorrectAnswerImage(String correctAnswerImage) {
		this.correctAnswerImage = correctAnswerImage;
	}


	// XmlElement sets the name of the entities
	@XmlElement(name = "wronganswer")
	public String getWrongAnswerImage() {
		return wrongAnswerImage;
	}
	public void setWrongAnswerImage(String wrongAnswerImage) {
		this.wrongAnswerImage = wrongAnswerImage;
	}


	// XmlElement sets the name of the entities
	@XmlElement(name = "showexitbutton")
	public boolean getShowExitButton() {
		return showExitButton;
	}
	public void setShowExitButton(boolean showExitButton) {
		this.showExitButton = showExitButton;
	}


	// XmlElement sets the name of the entities
	@XmlElement(name = "showoptionsbutton")
	public boolean getShowOptionsButton() {
		return showOptionsButton;
	}
	public void setShowOptionsButton(boolean showOptionsButton) {
		this.showOptionsButton = showOptionsButton;
	}
}
